#!/usr/bin/python
# encoding: utf-8
'''
@File    :   code.py
@Time    :   2020/03/11 21:54:19
@Author  :   fangkaijin 
@Version :   1.0
@Contact :   fangkaijin@gmail.com
@License :   杭州移动互联
@Desc    :   None
'''

# 导入库包

import sys, os

#print(os.name)

#print(os.uname())

l = list()
with open('/Users/fangkaijin/pip.conf', 'r') as f:
    print(f.name)
    done = False
    while not done:
        aline = f.readline()
        if("" != aline):
            l.append(aline)
        else:
            done = True
print(l)

print(os.path.abspath('.'))

pid = os.fork()
if 0==pid:
    print('I am child process (%s) and my parent is %s.' % (os.getpid(), os.getppid()))
else:
    print('I (%s) just created a child process (%s).' % (os.getpid(), pid))

#兼容windows
from multiprocessing import Process, Pool
import time, random

#子进程执行方法
def func_proc(name):
    print('子进程运行参数 %s (%s)' % (name, os.getpid()))

if __name__ == '__main__':
    print('父进程参数 %s' % (os.getpid()))
    p = Process(target=func_proc, args=('test',))
    print('子进程即将开始运行')
    p.start()
    p.join()
    print('子进程运行结束')




        



